//
//  DisscussDetailsTableViewCell.m
//  BookSale
//
//  Created by dlios on 15-3-10.
//  Copyright (c) 2015年 dlios. All rights reserved.
//

#import "DisscussDetailsTableViewCell.h"

@implementation DisscussDetailsTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatsSubviews];
    }
    return self;
}


- (void)creatsSubviews
{
    
    self.custimageView = [[UIImageView alloc] initWithFrame:CGRectMake(20, 20, 36, 36)];
    self.custimageView.layer.masksToBounds = YES;
    self.custimageView.layer.cornerRadius = 18;
    [self.contentView addSubview:self.custimageView];
    
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(65, 30, 300, 30)];
    self.nameLabel.text = @"asdasdasdasdasdasdasdasdasddas";
    [self.contentView addSubview:self.nameLabel];
    
    

    self.bodyLabel = [[UILabel alloc]initWithFrame:CGRectMake(30, 65, 315, 40)];
    self.bodyLabel.text = @"sadadadasdadasdasdasdasd;lkasdnalsdjasdhoiasdjnansdjiasnklsfjas.dfkhjasfmsdfofnasfjashfasldfniausdfhasldfnbkasdhfas,dfmspofjasodfnbasidfugasiodfmaskfniausdyfasdfm,a.sdflk;asdfmnasdfhioasdfkas;dfmpoasdfkasdmfnaskdjbfsdfvks;adlkfpaosdflasdjbhfiuasdfalsdmf.sadfnsjdfhsdklfnlsdafhisudgfosdmfglasdjfa;sdfjhsdsiefwlefjosdlkfnoisdfhdjksfnsdiojasdldfsjoidsfofnhoiassksiswonsuibduwobuzhidao nizhidaoshej=nmekuaidiangaosuwo wozhendehenxiangzhideao xianzai suduadiana adkasdkjpaosdjasdojasdnaoisdjasdjoaisdjadjoiasdjnalksjoadnjaksdjpasdnladjpasdnosfam;sodifjanfkliasffasdnfoasdin osiadjfmasioaksdfl;jdksfopasfjmalskfjasdfkna;osidfjasnlfkaosdfjnasld;kfhoasdifjnas;odifjaosdfjoasidfjnaskld;fhoasdfjna;sdfhoas;dfhnaos;dfjasldfhoasidfjnasl;dfhoasdifjnla;sdkfhoasdjfn;asiodfjap'sdfjaposdfjnoasidfjalsdkfjpasodfjmnasdfjamsnldfkjasdfnasidfjnasldkfjasdlkfaopsdfjaslkdfjpasdfjo;asdfjas;dfjsafjaosdfjsaldfjopasdfjasodfjasdjfaopsdjfao;sdfjlasdfhjoiasdjfnsadoifjnasdkfjasl;dfnasdsadfjpoasdjfaopsdfjasldkfopasdfjna;sodfjnaskdfnosadfnksadfjasdlfkjaspdf;lnjaosdfjnsadlfojasd'fnps'adfmalsdkfjmnalsdfjmnasldfjasldfkjasdfmnsoadfjmasdfaopsdfjmnasdlfjpasdnfoasdnf";
    self.bodyLabel.numberOfLines = 0;
    self.bodyLabel.font = [UIFont systemFontOfSize:15.0];
    [self.contentView addSubview:self.bodyLabel];
//
//    CGRect frame = self.bodyLabel.frame;
//    frame.size.height = [[self class] heightForText:self.user.body];
//    self.bodyLabel.frame = frame;
//    self.bodyLabel.text = self.user.body;
//    //修改scrollView.contectSize的大小
    
    

}





+(CGFloat)heightForText:(NSString *)text
{
    CGSize size = CGSizeMake(315, 3000000);
    NSDictionary *dic = [NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:15.0] forKey:NSFontAttributeName];
    
    CGRect fram =  [text boundingRectWithSize:size/*设置要计算内容的大小*/ options:NSStringDrawingUsesLineFragmentOrigin/*计算方式*/ attributes:dic/*设置字体属性*/ context:nil/*设为nil*/];
    return fram.size.height;
}
























- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
